package com.yuw.hwhigher04;

public class HourlyEmployee extends ColaEmployee {
	// 属性
	// 小时工资
	private double hourlySalary;
	// 工作的小时数
	private double hours;

	@Override
	public double getSalary(int month) {
		// 计算小时工工资
		double mySalary = 0;
		// 每月工作超出160 小时的部分按照1.5 倍工资发放
		if (this.getHours() > 160) {
			mySalary = this.getHourlySalary() * (160 + (this.getHours() - 160) * 1.5);
		} else {
			mySalary = this.getHourlySalary() * this.getHours();
		}
		// super.getSalary(month) 表示本月工资是否有生日金
		return mySalary + super.getSalary(month);
	}

	public double getHourlySalary() {
		return hourlySalary;
	}

	public void setHourlySalary(double hourlySalary) {
		this.hourlySalary = hourlySalary;
	}

	public double getHours() {
		return hours;
	}

	public void setHours(double hours) {
		this.hours = hours;
	}

	public HourlyEmployee(String empName, int empMonth, double hourlySalary, double hours) {
		super(empName, empMonth);
		this.hourlySalary = hourlySalary;
		this.hours = hours;
	}

	public HourlyEmployee() {
		super();
	}

}
